package com.myapp.web.action.user;

import com.myapp.model.entity.user.User;
import com.myapp.service.user.UserBo;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;

public class UserAction extends ActionSupport implements ModelDriven<User> {
	
	private static final long serialVersionUID = -3597276287398589691L;
	
	private User user = new User();
	
	private String verifyCode;
	
	public void setVerifyCode(String verifyCode) {
		this.verifyCode = verifyCode;
	}

	private static final Logger LOG = LoggerFactory.getLogger(UserAction.class);
	
	private UserBo userBo;
		
	public String execute() throws Exception {
		LOG.info("execute ...............\n");
        return SUCCESS;
    }
	
	public String exec() throws Exception
	{
		LOG.info("exec ...............\n");
		return SUCCESS;
	}
	
	public String register()
	{ 
		userBo.registerUser(user);
		LOG.info(user.getFirstName());
		LOG.info("verifyCode : "+verifyCode);
		return SUCCESS;
	}

	@Override
	public User getModel() {
		return user;
	}

	public void setUserBo(UserBo userBo) {
		this.userBo = userBo;
	}
}
